package com.flyxteam.supports.model;

import java.io.Serializable;

/**
 * 通用的操作结果
 * <ul>
 * <li>2017-01-01 | ChrisX | + create</li>
 * </ul>
 * @author ChrisX
 */
public class ActionResult implements Serializable {

    private static final long serialVersionUID = -2530135612502050236L;
    protected String code;
    protected String message;
    protected Object data;
    
    public ActionResult() {}
    
    public ActionResult(String code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public boolean isSuccess() {
        return code != null && code.equals("200");
    }
    
    public String toString() {
        return this.getClass().getName() + " ["
            + "code=" + code 
            + ", message=" + message 
            + ", data=" + data 
        + "]";
    }
    
    // #getter/setter
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }
    // /getter/setter
}
